package com.example.demo.Utils;


import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.IOException;

/**
 * 生成 解析  二维码,状态码
 *
 * @blame Android Team
 */

public class CodeUtils {
    public static final int  NOT_FOUND  = 44033;
    public static final int  AUTH_ERROR = 33022;
    public static final int  SERVER_ERROR = 55044;
    @AllArgsConstructor
    @Data
    @Builder
    @NoArgsConstructor
    public static class Message{
        private int code;
        private String message;
        public static Message parseStringToMessage(String res)throws IOException{
            return new ObjectMapper().readValue(res,CodeUtils.Message.class);
        }
        public static String encodeMessageToToString(Object res)throws   IOException {
            return new ObjectMapper().writeValueAsString(res);
        }
    }
}
